<h1>Sales Details</h1>


<table class="table table-striped table-bordered" width="100%" id="example">
	<thead>
    <tr>
		<th>Invoice No</th>
		<th>Sale Date</th>
        <th>Customer Name</th>
        <th>Toatal Price</th>
		<th>Transaction Type</th>
		<th>Options</th>
	</tr>
    </thead>
	<?php foreach ($all_sales as $report):?>
		<tr>
			<td><a href="<?= site_url('report/daily_report/get_product').'/'.$report->id ;?>"  data-toggle="modal"><?php echo $report->invoice_no;  ?></a></td>

			<td><?php  echo $report->date; ?></a></td>
		    <td><?php  echo $this->daily_model->get_customer($report->id_customer); ?></td>
            <td><?php  echo $report->total_price; ?></td>
           <td><?php  if($report->transaction_type == 0){echo "Cash"; }else{ echo "Debit"; }; ?></td>
		   <td><!--<?php echo anchor("sales/sales/edit_sale/".$report->id, 'Edit') ;?>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <a href="<?php echo site_url('sales/sales/delete_sale/').'/'.$report->id;?>" onclick="return confirm('Are you sure you want to DELETE this purchaser??')">Delete</a>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="<?php echo site_url('sales/sales/view_unique_sales/').'/'.$report->id.'/'.$report->invoice_no;?>" role="button" class="ccdc" data-toggle="modal">View details</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
<a href="<?php echo site_url('sales/sales/report/').'/'.$report->id.'/'.$report->invoice_no;?>" >Print</a>
	     </td>
		</tr>
	<?php endforeach;?>
</table>

<!--<p><a href="<?php echo site_url('auth/create_report');?>">Create a new report</a> | <a href="<?php echo site_url('auth/create_group');?>">Create a new group</a>
<a href="<?php echo site_url('auth/logout');?>">Logout</a>
</p>-->


    <!-- Button to trigger modal -->
    
     
    <!-- Modal -->

 
<!-- Modal -->

 
<!-- Modal -->
<script>
$(document).ready(function() {
	
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
	e.preventDefault();
	var url = $(this).attr('href');
	if (url.indexOf('#') == 0) {
		$(url).modal('open');
	} else {
		$.get(url, function(data) {
			$('<div class="modal hide fade">' + data + '</div>').modal();
		}).success(function() { $('input:text:visible:first').focus(); });
	}
});
	
});
</script>
<script>   
  // subtasks edit scripts
		
$('.ccdc').click(function(event) {	
  event.preventDefault();
  $.get(this.href, function(html) {
  $(html).appendTo('body').modal(); 
  });
});
</script>